Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Windows.Forms

Public Class FrmCrLietKePhieuKeToan

    Private Tungay, Denngay As String
    Private customerReport As ReportDocument

    Private Sub FrmCrLietKePhieuKeToan_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        frmLoading.Show()
        Dim sqlQuery As String
        sqlQuery = "SELECT maphieu,ngaylap,makhach,diengiai,doituong,tienvat,thanhtien,tongtien from tbl_phieunhapketoan "
        sqlQuery += "WHERE  ngaylap BETWEEN '" & Format(CDate(Tungay), "yyyy-MM-dd") & "'"
        sqlQuery += " AND '" & Format(CDate(Denngay), "yyyy-MM-dd") & "' "
        sqlQuery += "order by maphieu,ngaylap"
        Dim reportPath = Application.StartupPath & "\" & "crLietKePhieuKeToan.rpt"
        customerReport = New ReportDocument()
        customerReport.Load(reportPath)
        customerReport.SetDataSource(moduleReportConfig.GetDataTable(sqlQuery))
        customerReport.SetParameterValue("TTungay", Tungay)
        customerReport.SetParameterValue("TDenngay", Denngay)
        customerReport.SetParameterValue("company", globalVariale.COMPANY)
        customerReport.SetParameterValue("address", globalVariale.ADDRESS)
        Me.CrNXTTongHopview.ReportSource = customerReport
        frmLoading.Close()
        frmLoading.Dispose()
    End Sub


    Public Sub setTungay(ByVal s As String)
        Tungay = s
    End Sub

    Public Sub setDenngay(ByVal s As String)
        Denngay = s
    End Sub

End Class
